#!/usr/bin/env python
 
# -*- coding:utf-8 -*-
 
import socket
 
import os
 
line=socket.socket(socket.AF_INET,socket.SOCK_STREAM)
 
line.bind(('127.0.0.1',51520))
 
line.listen(5)
 
print('waiting commd------->')
 
while True:
    conn,addr=line.accept()
    msg=conn.recv(1024)
 
    if msg == 'q':
 
        break
 
    print('get commd:',msg)
 
    result=os.popen(str(msg)).read()
 
    conn.send(('result: '+result).encode('utf-8'))
 
    conn.close()
 
